<template>
	<jk-dialog
		v-model="showDialog"
		:title="`${machineItem ? machineItem.machineName : '机台'}产量`"
		width="800px"
		:show-content-loading="showLoading"
		:append-to-body="false"
		:modal-append-to-body="false"
		:modal="false"
		:show-close-btn="true"
		:show-confirm-btn="false"
		:show-cancel-btn="false"
		@on-close="onVisibleChange(false)"
		@on-visible-change="onVisibleChange"
	>
		<div>
			<el-form ref="ruleForm" :model="machineItem" :hide-required-asterisk="false" label-width="100px" :show-message="false">
				<el-row class="flex-start-center-wrap">
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="实时产量(kg)">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.accumulateShiftQty }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="称重产量(kg)">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.accumulateWeighNetWeight }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="能耗(kw·h)">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.accumulateEnergy }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="工时">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.workHours }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="开台表数">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.startOutput }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="了机表数">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.endOutput }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="开台时间">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.startTime }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item class="margin-bottom-10" label="了机时间">
							<span class="read-only-2 big-ipt-inner-custom">{{ machineItem.endTime }}</span>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
		</div>
		<jk-table border :stripe="false" :show-header="true" :data="machineItem.machineDayDateList" :height="300">
			<vxe-column title="日期" align="left" field="belongDate" :width="110"></vxe-column>
			<vxe-column title="实时产量(kg)" align="right" field="shiftQty" :width="110"></vxe-column>
			<vxe-column title="称重产量(kg)" align="right" field="weighNetWeight" :width="110"></vxe-column>
		</jk-table>
	</jk-dialog>
</template>

<script>
    import calHeight from '/src/mixins/cal-table-height';
    export default {
        props: {
            dialogState: {
                type: Boolean,
                default: false
            },
            machineItem: {
                type: Object,
                default() {
                    return {};
                }
            }
        },
        mixins: [calHeight],
        data() {
            return {
                showDialog: false,
                showLoading: false,
                ruleForm: {}
            };
        },
        methods: {
            onVisibleChange(e) {
                this.$emit('on-visible-change', e);
                if (!e) {
                    Object.assign(this.$data, this.$options.data());
                }
            }
        },
        watch: {
            dialogState(newVal) {
                this.showDialog = newVal;
            }
        }
    };
</script>
